/**
 * 
 */
package com.dsteiner.xelavos.client.model;

import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;

import com.dsteiner.widgets.client.PropertyChangeCollection;
import com.dsteiner.widgets.client.Widgets.IWidget;
import com.dsteiner.widgets.client.domain.ModelObject;
import com.dsteiner.xelavos.client.controller.IModelObjectBuilder;
import com.dsteiner.xelavos.client.controller.CreateObjectController.ImageSuggestions;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

public class CreateObjectModel {
	private PropertyChangeCollection propertyChangeSupport = new PropertyChangeCollection(
			this);

	private IModelObjectBuilder modelObjectBuilder;

	private IWidget contentWidget;

	private String imageSearch;

	private ModelObject createModelObject;

	private AbstractImagePrototype icon;

	public AbstractImagePrototype getIcon() {
		return icon;
	}

	
	private List<ImageSuggestions> imageSuggestions = new ArrayList<ImageSuggestions>();

	public List<ImageSuggestions> getImageSuggestions() {
		return imageSuggestions;
	}

	public void setImageSuggestions(List<ImageSuggestions> imageSuggestions) {
		List<ImageSuggestions> oldImageSuggestions = this.imageSuggestions;
		this.imageSuggestions = imageSuggestions;
		propertyChangeSupport.firePropertyChange("imageSuggestions", oldImageSuggestions, imageSuggestions);
	}
	
	public void setIcon(AbstractImagePrototype icon) {
		AbstractImagePrototype oldIcon = this.icon;
		this.icon = icon;
		propertyChangeSupport.firePropertyChange("icon", oldIcon, icon);
	}
	
	private String title;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		String oldTitle = this.title;
		this.title = title;
		propertyChangeSupport.firePropertyChange("title", oldTitle, title);
	}
	public ModelObject getCreateModelObject() {
		return createModelObject;
	}

	public void setCreateModelObject(ModelObject createModelObject) {
		ModelObject oldCreateModelObject = this.createModelObject;
		this.createModelObject = createModelObject;
		propertyChangeSupport.firePropertyChange("createModelObject", oldCreateModelObject, createModelObject);
	}
	
	public String getImageSearch() {
		return imageSearch;
	}

	public void setImageSearch(String imageSearch) {
		String oldImageSearch = this.imageSearch;
		this.imageSearch = imageSearch;
		propertyChangeSupport.firePropertyChange("imageSearch", oldImageSearch, imageSearch);
	}
	public void addPropertyChangeListener(String propertyName,
			PropertyChangeListener listener) {
		propertyChangeSupport.registerPropertyChangeListener(
				propertyName, listener);
	}

	public IWidget getContentWidget() {
		return contentWidget;
	}

	public IModelObjectBuilder getModelObjectBuilder() {
		return modelObjectBuilder;
	}

	public void setContentWidget(IWidget contentWidget) {
		IWidget oldContentWidget = this.contentWidget;
		this.contentWidget = contentWidget;
		propertyChangeSupport.firePropertyChange("contentWidget", oldContentWidget, contentWidget);
	}
	
	public void setModelObjectBuilder(IModelObjectBuilder modelObjectBuilder) {
		IModelObjectBuilder oldModelObjectBuilder = this.modelObjectBuilder;
		this.modelObjectBuilder = modelObjectBuilder;
		propertyChangeSupport.firePropertyChange("modelObjectBuilder", oldModelObjectBuilder, modelObjectBuilder);
	}
}